import request from '../utils/request';

// 发布文章
export const PublishArticleApi = (data, draft = false) => {
  return request({
    url: `/v1_0/mp/articles?draft=${draft}`,
    method: 'post',
    data,
  });
};

// 编辑按钮获取文章数据
export const getArticleByIdApi = (id) => {
  return request({
    url: `/v1_0/mp/articles/${id}`,
  });
};

// 编辑文章
export const updateArticleApi = (id, data, draft) => {
  return request({
    url: `/v1_0/mp/articles/${id}?draft=${draft}`,
    method: 'put',
    data,
  });
};
